<%@ page language="java" contentType="text/html; charset=utf8" pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<script type="text/javascript">
            function validation(obj) 
            {
            	var return_value = true;
            	var str, reg, msg_err="";
            	
            	var idArray = new Array("login","pass");
            	var idReg = new Array(/^[A-Za-z0-9]+$/,
            						  /^[A-Za-z0-9]+$/);
         		
                for (var i=0; i<2; i++) {
               		str=document.getElementById(idArray[i]).value;
              	  	if(RegExp(idReg[i]).exec(str) == null) {
              	  	    document.getElementById("err"+idArray[i]).value='не верный ввод';
                    	return_value = false;
              	  	}
              	  	else 
              	  		document.getElementById("err"+idArray[i]).value=' ';
              	}
                return return_value;
            }
        </script>
<div class="user">Создание нового пользователя</div>
<br/>
<table border="1" bordercolor="#000000" width="95%" cellspacing="0"  cellpadding="0">
	<form:form method="POST" commandName="user" onsubmit="return validation(this)">
		<tr>
			<td width="140" class="list_user_head">Логин:</td>
			<td align="left">
				<form:input path="login" id="login" class="inputbox" /><input type="text" class="err" readonly id="errlogin" />
			</td>
		</tr>
		<tr>
			<td class="list_user_head">Пароль:</td>
			<td align="left">
				<form:input type="password" path="pass" id="pass" class="inputbox" /><input type="text" class="err" readonly id="errpass" />
			</td>
		</tr>
		<tr>
			<td class="list_user_head">Роль</td>
			<td align="left">
				<form:select path="role" class="inputbox" >
					<form:option value="ROLE_ADMIN" label="Admin" />
					<form:option value="ROLE_USER"  label="User" />
				</form:select>
			</td>
		</tr>
		<tr >
			<td height="40" colspan="2" ><input type="submit" value="Добавить"/></td>
		</tr>
		<tr >
			<td height="40" colspan="2" >${checkLogin}</td>
		</tr>
	</form:form>
</table>





